﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Altairis.MailToolkit;

namespace SampleLocalPickup {
    public partial class Default : System.Web.UI.Page {

        protected void Page_Load(object sender, EventArgs e) {

        }

        protected void SendButton_Click(object sender, EventArgs e) {
            var count = int.Parse(this.NumberTextBox.Text);
            var sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            for (int i = 0; i < count; i++) {
                var ids = Guid.NewGuid().ToString();
                Mailer.SendTemplatedMessage(
                    ids + "@altairis.cz",   // recipient
                    "Test",                 // template
                    i);                     // {0}
            }
            sw.Stop();

            this.LiteralStats.Text = string.Format(this.LiteralStats.Text,
                sw.ElapsedMilliseconds,
                (float)sw.ElapsedMilliseconds / count);
            this.MultiViewPage.SetActiveView(this.ViewResults);
        }

    }
}